# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=btproxy-mitm
pkgver=71.cd1c906
pkgrel=6
pkgdesc='Man in the Middle analysis tool for Bluetooth.'
groups=('blackarch' 'blackarch-bluetooth')
arch=('x86_64' 'aarch64')
url='https://github.com/conorpp/btproxy'
license=('GPL3')
depends=('python2' 'python2-dbus' 'bluez-libs' 'gcc')
makedepends=('git' 'python2-setuptools')
source=("$pkgname::git+https://github.com/conorpp/btproxy.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  python2 setup.py build
}

package() {
  cd $pkgname

  python2 setup.py install --root="$pkgdir" --skip-build

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md LICENSE.txt

  mv "$pkgdir/usr/bin/btproxy" "$pkgdir/usr/bin/$pkgname"
}

